<!DOCTYPE html>
<html>
    <body onload="getBlogPosts();"> 
        <style>
            .post {margin-bottom: 20px;}
        </style>

        <div id="output"></div>

        <script>
            var createXhr = function(method, url) {
                var xhr = new XMLHttpRequest();
                xhr.onerror = function() {
                    document.getElementById('output').innerHTML = 'ERROR'; 
                };
                xhr.open(method, url, true);
                return xhr;
            };

            var getBlogPosts = function() {
                var xhr = createXhr('GET', 'http://localhost:18082/api/login/nologin/register'); 
                xhr.onload = function() { 
                    var data = JSON.parse(xhr.responseText);
                    console.log(data)
                };
                xhr.send();
            };
        </script>
    </body>
</html>
